let marbleRaceLevel18_3 = {
	name: 'Game 18 Level 3',
	id: '18_3',
	type: 'elimination',
	eliminated: 1,
	objects: [
		// Portals
		{
			type: 'object',
			shape: 'rect',
			color: '@a',
			toPortal: 'a',
			x: 130,
			y: 540 - 10,
			width: 100,
			height: 20
		},
		{
			type: 'object',
			shape: 'rect',
			color: '@b',
			toPortal: 'b',
			x: 230,
			y: 540 - 10,
			width: 100,
			height: 20
		},
		{
			type: 'object',
			shape: 'rect',
			color: '@a',
			toPortal: 'a',
			x: 370 - 45,
			y: 540 - 10,
			width: 90,
			height: 20
		},
		{
			type: 'object',
			shape: 'rect',
			color: '@c',
			toPortal: 'c',
			x: 370 + 45,
			y: 540 - 10,
			width: 90,
			height: 20
		},
		{
			type: 'object',
			shape: 'rect',
			color: '@a',
			toPortal: 'a',
			x: 530 - 35,
			y: 540 - 10,
			width: 70,
			height: 20
		},
		{
			type: 'object',
			shape: 'rect',
			color: '@goal',
			toPortal: 'goal',
			isGoal: true,
			x: 530 + 35,
			y: 540 - 10,
			width: 70,
			height: 20
		},
		{
			type: 'object',
			shape: 'circle',
			color: '@a',
			portalID: 'a',
			x: 180,
			y: 80,
			radius: 5
		},
		{
			type: 'object',
			shape: 'circle',
			color: '@b',
			portalID: 'b',
			x: 370,
			y: 80,
			radius: 5
		},
		{
			type: 'object',
			shape: 'circle',
			color: '@c',
			portalID: 'c',
			x: 530,
			y: 80,
			radius: 5
		},

		// Goal portal
		{
			type: 'object',
			shape: 'circle',
			color: '@goal',
			portalID: 'goal',
			x: 700,
			y: 80,
			radius: 5
		},

		// Obstacles
		{
			type: 'object',
			shape: 'rect',
			color: '@tertiary',
			x: 280,
			y: 300,
			width: 20,
			height: 600
		},
		{
			type: 'object',
			shape: 'rect',
			color: '@tertiary',
			x: 460,
			y: 300,
			width: 20,
			height: 600
		},

		// Borders
		{
			type: 'object',
			shape: 'rect',
			color: '@tertiary',
			x: 400,
			y: 0,
			width: 800,
			height: 120
		},
		{
			type: 'object',
			shape: 'rect',
			color: '@tertiary',
			x: 400,
			y: 600,
			width: 800,
			height: 120
		},
		{
			type: 'object',
			shape: 'rect',
			color: '@tertiary',
			x: 0,
			y: 300,
			width: 160,
			height: 600
		},
		{
			type: 'object',
			shape: 'rect',
			color: '@tertiary',
			x: 800,
			y: 300,
			width: 160,
			height: 600
		},
		{
			type: 'object',
			shape: 'rect',
			color: '@tertiary',
			x: 640,
			y: 300,
			width: 80,
			height: 600
		},

		// Marbles
		{
			type: 'marbles',
			x: 180,
			y: 80,
			launchTime: 3,
			launchRadius: 75,
			passX: 700,
			passY: 80,
			radius: 8,
			eliminatedRadius: 6,
			velocity: 5
		},
	]
}
{
	let cntI = 2
	for (let i = 0; i <= cntI; ++i) {
		let x0=[180,370,530][i]
		let cntJ = 10
		for (let j = 0; j < cntJ; ++j){
			let p0=j/cntJ*(Math.PI+Math.PI)
			marbleRaceLevel18_3.objects.push({
				type: 'object',
				shape: 'circle',
				color: '@secondary',
				x: 0,
				y: 0,
				radius: 5,
				onBeforeUpdate: function (object, engine) {
					let phase=Math.sin(engine.time+engine.time)+p0
					engine.setPosition(object.body,[x0+100*Math.cos(phase),300-100*Math.sin(phase)])
				}
			})
		}
	}
}
marbleRaceLevels.push(marbleRaceLevel18_3)